//
//  DCBaseChatTableViewCell.m
//  xmppTest
//
//  Created by striby on 15/12/30.
//  Copyright © 2015年 com.dc. All rights reserved.
//

#import "DCBaseChatTableViewCell.h"
@interface DCBaseChatTableViewCell()
{
   
}

@end


@implementation DCBaseChatTableViewCell
@synthesize sendTimeBackgroundView;

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self setSelectionStyle:UITableViewCellSelectionStyleNone];
        
        self.isDisplaySendTime =YES;
        self.isDisplayUserNickName = YES;
        self.isDisplayBaseContnentView=YES;
        self.isDisplayBottomStatusView=NO;
        
        _messageDirection = DCChatDirectionRight;
        [self loadBaseUI];
        
    }
    
    return self;
}

-(void)loadBaseUI
{
    self.backgroundColor = [UIColor clearColor];
    self.contentView.backgroundColor = [UIColor clearColor];
    
    /**
     发送时间背景
     */
    sendTimeBackgroundView = [[UIView alloc]initWithFrame:CGRectZero];
    sendTimeBackgroundView.backgroundColor = [UIColor lightGrayColor];
    sendTimeBackgroundView.alpha = 0.85;
    sendTimeBackgroundView.layer.cornerRadius = 5;
    sendTimeBackgroundView.layer.masksToBounds = YES;

    [self.contentView addSubview:sendTimeBackgroundView];
    
    /**
     发送时间 label
     */
    _sendTimeLbl =[[UILabel alloc]initWithFrame:CGRectZero];
    self.sendTimeLbl.textColor = [UIColor whiteColor];
    
    self.sendTimeLbl.textAlignment = NSTextAlignmentCenter;
    
    self.sendTimeLbl.font = [UIFont systemFontOfSize:sendTimeFontSize];
    
    self.sendTimeLbl.backgroundColor = [UIColor clearColor];

    [sendTimeBackgroundView addSubview:self.sendTimeLbl];
    
    /**
     主视图
     */
    _baseContentView = [[UIView alloc]initWithFrame:CGRectZero];
    
    self.baseContentView.backgroundColor = [UIColor clearColor];

    [self.contentView addSubview:self.baseContentView];
    
    /**
     用户头像
     */
    _userIconImageView = [[UIImageView alloc]initWithFrame:CGRectZero];

    [self.baseContentView addSubview:_userIconImageView];
    
    /**
     用户昵称
     */
    _nickNameLabel = [[UILabel alloc]initWithFrame:CGRectZero];
    
    _nickNameLabel.font = [UIFont systemFontOfSize:nickNameFontSize];
    
    _nickNameLabel.textColor = [UIColor darkGrayColor];
    
    _nickNameLabel.backgroundColor = [UIColor clearColor];
   
    [self.baseContentView addSubview:_nickNameLabel];
    
    
    /**
     *  底部区域
     */
    
    _bottomStatusView = [[UIView alloc]initWithFrame:CGRectZero];
    _bottomStatusView.backgroundColor = [UIColor lightGrayColor];
    _bottomStatusView.alpha = 0.85;
    _bottomStatusView.layer.cornerRadius = 5;
    _bottomStatusView.layer.masksToBounds = YES;
    
    [self.contentView addSubview:_bottomStatusView];
    
    _bottomIconView = [[UIImageView alloc]initWithFrame:CGRectZero];
    [_bottomStatusView addSubview:_bottomIconView];
    
    _bottomStatusLbl = [[UILabel alloc]initWithFrame:CGRectZero];
    _bottomStatusLbl.textColor = self.sendTimeLbl.textColor;
    
    _bottomStatusLbl.textAlignment = NSTextAlignmentCenter;
    
    _bottomStatusLbl.font = [UIFont systemFontOfSize:sendTimeFontSize];
    
    _bottomStatusLbl.backgroundColor = [UIColor clearColor];
    
    [_bottomStatusView addSubview:self.bottomStatusLbl];
}

-(void)setMessageDirection:(DCChatDirection)messageDirection
{
    _messageDirection = messageDirection;
    
    
  
}

///////////////////////////////////////////////////////
///////////////////////////////////////////////////////


@end
